//混合的表格请求数据
import { getAllORG, changeRes } from "@/api/common";
import { deepClone } from '@/utils/index';

export default {
    data() {
        return {
            orgs: []
        }
    },
    methods: {
        //初始化机构数据
        initORG() {
            return new Promise((resolve, reject) => {
                // 请求数据
                getAllORG().then(res => {
                    if (res.code === 10000) {
                        let data = deepClone(res.result);
                        this.orgs = data.map(item => {
                            return {
                                label: item.organizationName?item.organizationName:'---',
                                value: item.organizationId?item.organizationId:'-999'
                            }
                        });
                        this.orgs.unshift({ label: '全部', value: "" })
                    }
                    resolve(res)
                }).catch(err => {
                    reject(err)
                })
            })
        },
    }
}